#ifndef OCL_BUFFER_INCLUDED
#define OCL_BUFFER_INCLUDED 1

#include "../ocl/context.h"

typedef struct 
{
	cl_mem       handle; /*!< a cl_mem = buffer */
	cl_mem_flags FLAGS;  /*!< CL_MEM_FLAGS      */
	size_t       SIZE;   /*!< CL_MEM_SIZE       */
} ocl_buffer;


#define OCL_BUFFER_INIT { NULL, 0, 0 }

int ocl_buffer_load(ocl_buffer  *buffer,
					ocl_context *context,
					cl_mem_flags flags,
					size_t       size,
					void        *host_ptr);

void ocl_buffer_quit(ocl_buffer *buffer);

#define ocl_buffer_of(TYPE,buffer,context,flags,size,host_ptr) ocl_buffer_load(buffer,context,flags,(size)*sizeof(TYPE),host_ptr)

#endif
